// JavaScript Document

// banner
$(document).ready(function(){

	$(".prev,.next").hover(
		function(){
			$(this).stop(true,false).fadeTo("show",0.9);
		},
		function(){
			$(this).stop(true,false).fadeTo("show",0.4);
		}
	);
	
	$(".body_banner").slide(
		{
			titCell:".hd ul",
			mainCell:".bd ul",
			effect:"fold",
			interTime:3500,
			delayTime:500,
			autoPlay:true,
			autoPage:true, 
			trigger:"click" 
		}
	);
});

// 左导航
$(document).ready(function(){
	$('.left_nav_bar li').click(function(){
		var index=$(this).index();
		$(this).siblings().removeClass('active');
		$(this).addClass('active');
		var div=document.getElementById('right_dis_panel');  
		
		var ul=div.childNodes; 
		var validindex=-1;
		for(var i=0;i<ul.length;i++){   
			if(ul.item(i).id != null){
				validindex += 1;
				var obj = ul.item(i);
				if(validindex == index)
				{
					obj.style.display='block';
				}
				else
				{
					obj.style.display='none';
				}
			}
		}
	});
});


// 设置为主页 
function SetHome(obj,vrl)
{ 
	try
	{ 
		obj.style.behavior='url(#default#homepage)';obj.setHomePage(vrl); 
	} 
	catch(e)
	{ 
		if(window.netscape) 
		{ 
			try 
			{ 
				netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
			} 
			catch (e) 
			{ 
				alert("此操作被浏览器拒绝！\n请在浏览器地址栏输入“about:config”并回车\n然后将 [signed.applets.codebase_principal_support]的值设置为'true',双击即可。"); 
			} 
			var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components.interfaces.nsIPrefBranch); 
			prefs.setCharPref('browser.startup.homepage',vrl); 
		}
		else
		{ 
			alert("您的浏览器不支持，请按照下面步骤操作：1.打开浏览器设置。2.点击设置网页。3.输入："+vrl+"点击确定。"); 
		} 
	} 
} 
// 加入收藏 兼容360和IE6 
function shoucang(sTitle,sURL) 
{ 
	try 
	{ 
		window.external.addFavorite(sURL, sTitle); 
	} 
	catch (e) 
	{ 
		try 
		{ 
			window.sidebar.addPanel(sTitle, sURL, ""); 
		} 
		catch (e) 
		{ 
			alert("加入收藏失败，请使用Ctrl+D进行添加"); 
		} 
	} 
}

function show_chaye_info(id)
{
	var div=document.getElementById('right_dis_panel');  	
	var ul=div.childNodes; 
	for(var i=0;i<ul.length;i++){   
		if(ul.item(i).id != null){
			var obj = ul.item(i);
			obj.style.display='none';
		}
	}
	
	$.ajax({
         url: "chaye_info.php",  
         type: "POST",
         data:{id:id},
         //dataType: "json",
         error: function(){  
             alert('Error loading XML document');  
         },  
         success: function(data,status){//如果调用php成功    
             //alert(unescape(data));//解码，显示汉
			 
			 $("#product_info").html(data);
			 var pinfo=document.getElementById('product_info');
			 pinfo.style.display='block';
         }
     });
}


function show_hongjiu_info(id)
{
	var div=document.getElementById('right_dis_panel');  	
	var ul=div.childNodes; 
	for(var i=0;i<ul.length;i++){   
		if(ul.item(i).id != null){
			var obj = ul.item(i);
			obj.style.display='none';
		}
	}
	
	$.ajax({
         url: "hongjiu_info.php",  
         type: "POST",
         data:{id:id},
         //dataType: "json",
         error: function(){  
             alert('Error loading XML document');  
         },  
         success: function(data,status){//如果调用php成功    
             //alert(unescape(data));//解码，显示汉
			 
			 $("#product_info").html(data);
			 var pinfo=document.getElementById('product_info');
			 pinfo.style.display='block';
         }
     });

}


function news_info(id)
{
	var div=document.getElementById('right_dis_panel');  	
	var ul=div.childNodes; 
	for(var i=0;i<ul.length;i++){   
		if(ul.item(i).id != null){
			var obj = ul.item(i);
			obj.style.display='none';
		}
	}
	
	$.ajax({
         url: "news_info.php",  
         type: "POST",
         data:{id:id},
         //dataType: "json",
         error: function(){  
             alert('Error loading XML document');  
         },  
         success: function(data,status){//如果调用php成功    
             //alert(unescape(data));//解码，显示汉
			 
			 $("#news_info").html(data);
			 var pinfo=document.getElementById('news_info');
			 pinfo.style.display='block';
         }
     });

}



